﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PluginOffice
{
    public partial class Form1 : Form
    {
        public Form1(Dictionary<string,bool> po)
        {
            pofiice = po;
            InitializeComponent();
            foreach (KeyValuePair<string,bool> item in po)
            {
                checkedListBox1.Items.Add(item.Key, item.Value);
            }
       
        }
        public Dictionary<string, bool> pofiice;
        private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (e.NewValue == CheckState.Checked)
            {
                try
                {
                    pofiice[checkedListBox1.SelectedItem.ToString()] = true;
                }
                catch { }
            }
            else
            {
                try
                {
                    pofiice[checkedListBox1.SelectedItem.ToString()] = false;
                }
                catch { }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
